import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'
import UserIndex from '../views/UserIndex.vue'
import AdminIndex from '../views/AdminIndex.vue'
import UserEquipment from '../views/UserEquipment.vue'
import UserTrack from '../views/UserTrack.vue'
import UserCoach from '../views/UserCoach.vue'
import UserOwn from '../views/UserOwn.vue'
import AdminManage from '../views/AdminManage.vue'
import UserManage from '../views/UserManage.vue'
import EquipmentManage from '../views/EquipmentManage.vue'
import TrackManage from '../views/TrackManage.vue'
import CoachManage from '../views/CoachManage.vue'
import NoticeManage from '../views/NoticeManage.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/userOwn',
      name: '个人中心',
      component: UserOwn,
    },
    {
      path: '/userCoach',
      name: '教练展示',
      component: UserCoach,
    },
    {
      path: '/userTrack',
      name: '滑雪赛道',
      component: UserTrack,
    },
    {
      path: '/userEquipment',
      name: '滑雪设备',
      component: UserEquipment,
    },
    {
      path: '/userIndex',
      name: '用户首页',
      component: UserIndex,
    },
    {
      path: '/adminIndex',
      name: '管理员首页',
      component: AdminIndex,
      redirect: '/adminManage',
      children: [
        {
          path: '/adminManage',
          name: '管理员管理',
          component: AdminManage,
        },
        {
          path: '/userManage',
          name: '用户管理',
          component: UserManage,
        },
        {
          path: '/equipmentManage',
          name: '设备管理',
          component: EquipmentManage,
        },
        {
          path: '/trackManage',
          name: '赛道管理',
          component: TrackManage,
        },
        {
          path: '/coachManage',
          name: '教练管理',
          component: CoachManage,
        },
        {
          path: '/noticeManage',
          name: '公告管理',
          component: NoticeManage,
        },
      ],
    },
    {
      path: '/login',
      name: '登录页面',
      component: Login,
    },
  ],
})

export default router
